#include <iostream>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

using namespace std;
int main()
{
    int fd = open("./log.txt", O_WRONLY | O_CREAT);
    cout << "fd:" << fd << endl;
    dup2(fd, 1);
    cout << "lalala" << endl;
    int n = write(fd, "bbbbbb", 6);

    return 0;
}